import React, {useState} from 'react';

const UseLoading = () => {
  const [isLoading, setLoadingState] = useState(false);
  const load = async (aPromise: Promise<any>) => {
    setLoadingState(true)
    await aPromise;
    return setLoadingState(false);
  };

return [isLoading , load] as const
};

export default UseLoading;
